﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace numer
{
    public class Container
    {
        private Main mMain = new Main();
        private MainScreen mMainscreen = new MainScreen();
        private NumberInput mNumberinput = new NumberInput();
        //M.Hamada　編集　▼
        public PlayGameScreen mPlayGameScreen = new PlayGameScreen();
        private ResultScreen mResultScreenWin = new ResultScreen();
        private ResultScreenLose mResultScreenLose = new ResultScreenLose();

        #region 定数
        //各画面に割り振られている番号
            private const int MAINSCREEN = 1;
            private const int INPUTSCREEN = 2;
            private const int PLAYSCREEN = 3;
            private const int RESULTSCREEN_WIN = 4;
            private const int RESULTSCREEN_LOSE = 5;
        #endregion

        public Main MainForm { get { return mMain; } }
        public NumberInput NumberInputForm { get { return mNumberinput; } }
        
        public Container()
        {
        }

        public enum DialogName
        {
            MainDialog = 0,
            MainScreen,
            NumberInput,
            PlayGameScreen,
            ResultScreen

        }

        public void Change(int iNum)
        {

            mMain.pnlMain.Controls.Clear();

            Form form = null;
            switch(iNum)
            {
                //メイン画面
                case MAINSCREEN:
                    form = mMainscreen;
                    break;
                //数値入力画面
                case INPUTSCREEN:
                    mNumberinput.BtnActivate();
                    form = mNumberinput;
                    break;
                //プレイ画面
                case PLAYSCREEN:
                    //mPlayGameScreen.BtnActivate();
                    form = mPlayGameScreen;
                    break;
                //結果画面
                case RESULTSCREEN_WIN:
                    form = mResultScreenWin;
                    break;
                case RESULTSCREEN_LOSE:
                    form = mResultScreenLose;
                    break;

            }

            //フォームが引き渡しが実行
            if (form != null)
            {
                // TopLevelコントロールでないようにする。
                form.TopLevel = false;
                // 外枠を消す.
                form.FormBorderStyle = FormBorderStyle.None;
                // 配置されているコントロールを表示する.
                form.Visible = true;


                mMain.pnlMain.Controls.Add(form);
            }

        }

    }
}
